<template>
  <van-row>
    <van-col span="5">
      <van-sidebar v-model="active">
        <van-sidebar-item v-for="item in classifData" :title="item.cat_name" />
      </van-sidebar>
    </van-col>
    <van-col span="18">
      <div v-for="items in classifData[active]?.children">
        <h4>
          {{ items.cat_name }}
        </h4>
        <router-link :to="'/goods/' + items.cat_id">
          <van-grid :column-num="4">
            <van-grid-item v-for="itemall in items.children" :icon="itemall.cat_icon" :text="itemall.cat_name" />
          </van-grid>
        </router-link>
      </div>
    </van-col>
  </van-row>
</template>

<script setup>
import { ref } from "vue";
let active = ref(0);
import { classifApi } from "@/api/api";
let classifData = ref([]);
classifApi().then((res) => {
  console.log(res);
  classifData.value = res.data.message;
});
</script>

<style lang="scss" scoped></style>